package com.thinkgem.jeesite.frame.pm.utils;

import com.thinkgem.jeesite.common.utils.SpringContextHolder;
import com.thinkgem.jeesite.frame.pm.entity.PmDataTreeItem;
import com.thinkgem.jeesite.frame.pm.service.PmDataTreeItemService;

import java.util.List;

/**
 * @Author:Kongxiangsheng
 * @DesCription:
 * @Date:Created in 15:02 2018/9/11
 * @Modified By:
 */
public class PmDataTreeUtils {
    private static PmDataTreeItemService pmDataTreeItemService = SpringContextHolder.getBean(PmDataTreeItemService.class);

    /**
     * 查询树形字典数据
     *
     * @param treeCode
     * @return
     */
    public static List<PmDataTreeItem> getDataTreeItemList(String treeCode) {
        return pmDataTreeItemService.getByTreeCode(treeCode);
    }

    /**
     * 得到树形节点的名称
     *
     * @param treeCode
     * @param itemId
     * @return
     */
    public static String getDateTreeItemValue(String treeCode, String itemId) {
        return pmDataTreeItemService.getTreeItemName(treeCode, itemId);
    }

    /**
     * 得到树形节点的名称
     *
     * @param treeCode
     * @param itemId
     * @return
     */
    public static PmDataTreeItem getDateTreeItem(String treeCode, String itemId) {
        return pmDataTreeItemService.getDateTreeItem(treeCode, itemId);
    }
}
